package com.rules.admin.vo;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.rules.admin.json.Long2String;
import com.rules.admin.json.String2Long;

import java.io.Serializable;
import java.util.Map;
import java.util.Set;

public class ProjectRoleVO implements Serializable {
   @JsonSerialize(
      using = Long2String.class
   )
   @JsonDeserialize(
      using = String2Long.class
   )
   private Long id;
   private Set<Integer> roles = Sets.newConcurrentHashSet();
   private Map<Long, PackageRoleVO> packageRoles = Maps.newConcurrentMap();

   public Long getId() {
      return this.id;
   }

   public void setId(Long id) {
      this.id = id;
   }

   public Set<Integer> getRoles() {
      return this.roles;
   }

   public void setRoles(Set<Integer> roles) {
      this.roles = roles;
   }

   public Map<Long, PackageRoleVO> getPackageRoles() {
      return this.packageRoles;
   }

   public void setPackageRoles(Map<Long, PackageRoleVO> packageRoles) {
      this.packageRoles = packageRoles;
   }

   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof ProjectRoleVO)) {
         return false;
      } else {
         ProjectRoleVO other = (ProjectRoleVO)o;
         if (!other.canEqual(this)) {
            return false;
         } else {
            label47: {
               Object this$id = this.getId();
               Object other$id = other.getId();
               if (this$id == null) {
                  if (other$id == null) {
                     break label47;
                  }
               } else if (this$id.equals(other$id)) {
                  break label47;
               }

               return false;
            }

            Object this$roles = this.getRoles();
            Object other$roles = other.getRoles();
            if (this$roles == null) {
               if (other$roles != null) {
                  return false;
               }
            } else if (!this$roles.equals(other$roles)) {
               return false;
            }

            Object this$packageRoles = this.getPackageRoles();
            Object other$packageRoles = other.getPackageRoles();
            if (this$packageRoles == null) {
               if (other$packageRoles != null) {
                  return false;
               }
            } else if (!this$packageRoles.equals(other$packageRoles)) {
               return false;
            }

            return true;
         }
      }
   }

   protected boolean canEqual(Object other) {
      return other instanceof ProjectRoleVO;
   }

   public int hashCode() {

      int result = 1;
      Object $id = this.getId();
      result = result * 59 + ($id == null ? 43 : $id.hashCode());
      Object $roles = this.getRoles();
      result = result * 59 + ($roles == null ? 43 : $roles.hashCode());
      Object $packageRoles = this.getPackageRoles();
      result = result * 59 + ($packageRoles == null ? 43 : $packageRoles.hashCode());
      return result;
   }

   public String toString() {
      return "ProjectRoleVO(id=" + this.getId() + ", roles=" + this.getRoles() + ", packageRoles=" + this.getPackageRoles() + ")";
   }
}
